package org.example.rest;

import org.springframework.web.bind.annotation.*;

/**
 * @Description 向用户问好
 * @Author chenhs
 * @Date 14:37 2025/7/26
 */
@RestController
@RequestMapping("/users")
public class UserController {

    @GetMapping("/hello")
    public String hello(@RequestHeader(value = "X-User-Info", required = false) String userInfo) {

        try {
            Thread.sleep(10*1000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }

        return "Hello from User Service! UserInfo: " + userInfo;
    }

    @GetMapping("/admin")
    public String adminOnly() {
        return "Admin endpoint";
    }
}